<div class="row">
    <p id="list-title">{{.PageName}}</p>
</div>
<form id="userForm" action="{{.URL}}{{.RecordID}}?action={{.Action}}" method="post" class="post-form form-horizontal {{if .Readonly}}form-disabled{{else}}form-edit{{end}}" role="form">
    <div class="row">
        {{if .RecordID}} {{if .Readonly}}
        <a href="{{.URL}}{{.RecordID}}?action=edit" class="btn btn-success fa fa-pencil pull-left form-edit-btn">&nbsp编辑</a>
        <a href="{{.URL}}?action=create" type="buttom" class="btn btn-success fa fa-plus pull-left form-create-btn">&nbsp新建</a>{{end}}{{end}}
        <button type="submit" form="userForm" class="btn btn-primary fa fa-save pull-left form-save-btn">&nbsp保存</button> {{if .Readonly}}
        <button type="button" class="btn btn-danger fa fa-remove  pull-left form-cancel-btn">&nbsp取消</button> {{else}}
        <a href="{{.URL}}" class="btn btn-danger fa fa-remove  pull-left">&nbsp取消</a> {{end}}
        <a href="{{.URL}}" class="btn btn-info fa fa-list pull-left">&nbsp列表</a>
    </div>
    {{ .xsrf }} {{if .RecordID}}
    <input type="hidden" data-type="int" name="recordID" id="record-id" class="{{.FormField}}" value="{{.RecordID}}"> {{end}}
    <div class="row">
        <div class="col-md-6">
            <fieldset>
                <legend>基本信息</legend>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="name" class="col-md-4 control-label label-start">用户名<span class="required-input">&nbsp*</span></label>
                        <div class="col-md-8">
                            <p class="p-form-control"> {{.User.Name}} </p>
                            <input data-type="string" class="form-control {{.FormField}}" id="name" name="Name" {{if not .Readonly}}autofocus{{end}} type="text" data-oldValue="{{.User.Name}}" value="{{.User.Name}}" />
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="namezh" class="col-md-4 control-label">用户名(中文)<span class="required-input">&nbsp*</span></label>
                        <div class="col-md-8">
                            <p class="p-form-control"> {{.User.NameZh}} </p>
                            <input data-type="string" class="form-control {{.FormField}}" id="namezh" name="NameZh" type="text" data-oldValue="{{.User.NameZh}}" value="{{.User.NameZh}}" />
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="mobile" class="col-md-4 control-label label-start">手机号码<span class="required-input">&nbsp*</span></label>
                        <div class="col-md-8">
                            <p class="p-form-control"> {{.User.Mobile}} </p>
                            <input data-type="string" class="form-control {{.FormField}}" name="Mobile" id="mobile" type="text" data-oldValue="{{.User.Mobile}}" value="{{.User.Mobile}}" />
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="tel" class="col-md-4 control-label">座机</label>
                        <div class="col-md-8">
                            <p class="p-form-control"> {{.User.Tel}} </p>
                            <input data-type="string" class="form-control {{.FormField}}" name="Tel" id="tel" type="text" data-oldValue="{{.User.Tel}}" value="{{.User.Tel}}" />
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="email" class="col-md-4 control-label label-start">邮箱<span class="required-input">&nbsp*</span></label>
                        <div class="col-md-8">
                            <p class="p-form-control"> {{.User.Email}} </p>
                            <input data-type="string" class="form-control {{.FormField}}" name="Email" id="email" type="email" data-oldValue="{{.User.Email}}" value="{{.User.Email}}" />
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="qq" class="col-md-4 control-label ">QQ</label>
                        <div class="col-md-8">
                            <p class="p-form-control"> {{.User.Qq}} </p>
                            <input data-type="string" class="form-control {{.FormField}}" name="Qq" id="qq" type="text" data-oldValue="{{.User.Qq}}" value="{{.User.Qq}}" />
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="Wechat" class="col-md-4 control-label">微信</label>
                        <div class="col-md-8">
                            <p class="p-form-control"> {{.User.WeChat}} </p>
                            <input data-type="string" class="form-control {{.FormField}}" name="WeChat" id="wechat" data-oldValue="{{.User.WeChat}}" type="text" value="{{.User.WeChat}}" />
                        </div>
                    </div>
                </div>
            </fieldset>
        </div>
        <div class="col-md-6">
            <fieldset>
                <legend>系统信息</legend>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="isadmin" class="col-md-4 control-label ">超级用户</label>
                        <div class="col-md-8 ">
                            <input name="isadmin" id="isadmin" class="form-control form-checkbox {{.FormField}}" type="checkbox">
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="active" class="col-md-4 control-label ">有效</label>
                        <div class="col-md-8 ">
                            <input name="Active" id="active" class="form-control form-checkbox {{.FormField}}" checked="checked" type="checkbox">
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="Department" class="col-md-4 control-label label-start">部门<span class="required-input">&nbsp*</span></label>
                        <div class="col-md-8">
                            <p class="p-form-control"> {{if .User}} {{if .User.Department}} {{.User.Department.Name}}{{end}} {{end}}</p>
                            <select data-type="int" aria-hidden="true" name="Department" id="department" class="form-control select-department {{.FormField}}" {{if .User}} {{if .User.Department}} data-default-id="{{.User.Department.ID}}" data-default-name="{{.User.Department.Name}}"
                                {{end}} {{end}}>
                            <!--option不能删除用于bootstrapValidator验证-->
                            <option value="{{if .User.Department}}{{.User.Department.ID}}{{end}}" selected="selected">{{if .User.Department}}{{.User.Department.Name}}{{end}}</option>
                        </select>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="position" class="col-md-4 control-label label-start">职位<span class="required-input">&nbsp*</span></label>
                        <div class="col-md-8">
                            <p class="p-form-control"> {{if .User}} {{if .User.Position}} {{.User.Position.Name}}{{end}} {{end}}</p>
                            <select data-type="int" name="Position" id="position" class="form-control select-position {{.FormField}}" {{if .User}} {{if .User.Position}} data-default-id="{{.User.Position.ID}}" data-default-name="{{.User.Position.Name}}" {{end}} {{end}}>
                            <option value="{{if .User.Position}}{{.User.Position.ID}}{{end}}" selected="selected">{{if .User.Position}}{{.User.Position.Name}}{{end}}</option>
                        </select>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="usergroup" class="col-md-4 control-label label-start">权限组<span class="required-input">&nbsp*</span></label>
                        <div class="col-md-8">
                            <p class="p-form-control"> {{if .User}} {{if .User.Groups}} {{range .User.Groups}}<a class='display-block label label-primary'>{{.name}}</a>{{end}}{{end}} {{end}}</p>
                            <select data-type="array_int" name="Group" id="usergroup" multiple="multiple" class="form-control select-group {{.FormField}}">
                            {{range  .User.Groups}}
                            <option value="{{.id}}" selected="selected">{{.name}}</option>
                            {{end}}
                        </select>
                        </div>
                    </div>
                </div>
            </fieldset>
        </div>
    </div>
</form>